= Message Queue Check Failures

[#before]
.Before each example
****
[e-mq-clean]#myQueue# is empty.
****

[.ExpectedToFail]
.Surplus messages
====
.Got message
[source,json,e-mq-set=myQueue]
----
{ "a": 1, "b": "some" }
----

.Expected no messages
[caption=, e-mq-check=myQueue]
|===
|===
====

[.ExpectedToFail]
.Surplus messages: await
====
.Got message
[source,json,e-mq-set=myQueue]
----
{ "a": 1, "b": "some" }
----

.Expected no messages
[caption=, e-mq-check=myQueue,e-await=1s]
|===
|===
====

[.ExpectedToFail]
.Missing messages
====
Got no messages.

.Expected single message
[cols="a", caption=, e-mq-check=myQueue]
|===
|[source,json]
----
{ "a": 1, "b": "some" }
----
|===
====

[.ExpectedToFail]
.Missing messages: await
====
Got no messages.

.Expected single message
[cols="a", caption=, e-mq-check=myQueue,e-await=1s]
|===
|[source,json]
----
{ "a": 1, "b": "some" }
----
|===
====

[.ExpectedToFail]
.Wrong payload
====
.Got message
[source,json,e-mq-set=myQueue]
----
{ "a": 1, "b": "some" }
----

.Wrong message body expectations
[cols="a", caption=, e-mq-check=myQueue]
|===
|[source,json]
----
{ "a": 1 }
----
|===
====

[.ExpectedToFail]
.Wrong headers or params
====
.Got messages:
[cols="a", grid=rows, frame=ends, caption=, e-mq-set=myQueue]
|===
|
[.params]
.Params
[cols="h,1", caption=]
,===
key, some-kafka-message-key
,===

[.headers]
.Headers
[cols="h,1", caption=]
,===
h1, {{isoDate (at '-1d')}}
h2, 2
,===

[source,json]
----
{ "a": 1, "b": "some" }
----

|
[.params]
.Params
[cols="h,1", caption=]
,===
key, some-kafka-message-key
partition, 1
,===

[.headers]
.Headers
[cols="h,1", caption=]
,===
h1, {{isoDate (at '-1d')}}
,===

[source,json]
----
{ "a": 1, "b": "some" }
----
|===

.Wrong expectations in headers and params
[cols="a", grid=rows, frame=ends, caption=, e-mq-check=myQueue]
|===
| Wrong headers expectaion
[.params]
.Params
[cols="h,1", caption=]
,===
key, some-kafka-message-key
,===

[.headers]
.Headers
[cols="h,1", caption=]
,===
h1, {{isoDate (at)}}
h2, 3
,===

[source,json]
----
{ "a": 1, "b": "some" }
----

| Wrong params expectation
[.params]
.Params
[cols="h,1", caption=]
,===
key, wrong
partition, 2
,===

[.headers]
.Headers
[cols="h,1", caption=]
,===
h1, {{isoDate (at '-1d')}}
,===

[source,json]
----
{ "a": 1, "b": "some" }
----
|===
====

[.ExpectedToFail]
.Big message
====
.Got message
[source,json,e-mq-set=myQueue,role=mh-200]
----
include::../data/mq/big.json[]
----

.Wrong expectations
[cols="a", caption=, e-mq-check=myQueue]
|===
|[source,json,role=mh-100]
----
include::../data/mq/msg.json/[]
----
|===
====
